Ubuntu 16.04
Sponsored Link

OpenStack Ocata : Neutron Networking(VXLAN)
2017/03/15
 
Configure virtual networking by OpenStack Network Service (Neutron).
For example, configure VXLAN type of networking on here.
Before it, Configure basic settings on Control Node, Network Node, Compute Node.
Furthermore, this example is based on the environment that Network Node has 2 network interfaces.
     ------------+--------------------------------+--------------------------------+------------
                 |                                |                                |
             eth0|10.0.0.30                   eth0|10.0.0.50                   eth0|10.0.0.51
     +-----------+-----------+        +-----------+-----------+        +-----------+-----------+
     |    [ Control Node ]   |        |    [ Network Node ]   |        |    [ Compute Node ]   |
     |                       |        |                       |        |                       |
     |  MariaDB    RabbitMQ  |        |                       |eth1    |        Libvirt        |
     |  Memcached  httpd     |        |  L2,L3,Metadata Agent +----    |      Nova Compute     |
     |  Keystone   Glance    |        |                       |        |        L2 Agent       |
     |  Nova API             |        |                       |        |                       |
     |  Neutron Server       |        |                       |        |                       |
     +-----------------------+        +-----------------------+        +-----------------------+

[1] Change settings on Control Node.
root@dlp ~(keystone)#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# line 115: add a value to tenant_network_types

tenant_network_types =
vxlan
# line 166: add

[ml2_type_flat]
flat_networks = physnet1
# line 220: add

[ml2_type_vxlan]
vni_ranges = 1:1000
root@dlp ~(keystone)#
systemctl restart neutron-server

[2] Change settings on Network Node.
root@network:~#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# line 115: add a value to tenant_network_types

tenant_network_types =
vxlan
# line 166: add

[ml2_type_flat]
flat_networks = physnet1
# line 220: add

[ml2_type_vxlan]
vni_ranges = 1:1000
root@network:~#
vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
# line 114: add

[agent]
prevent_arp_spoofing = True
# line 145: add

[linux_bridge]
physical_interface_mappings = physnet1:eth1
# line 181: add

[vxlan]
enable_vxlan = True
l2_population = True
root@network:~#
vi /etc/neutron/dhcp_agent.ini
# line 83: add

dnsmasq_config_file = /etc/neutron/dnsmasq-neutron.conf
root@network:~#
vi /etc/neutron/dnsmasq-neutron.conf
# create new

dhcp-option-force=26,1450
root@network:~#
for service in l3-agent dhcp-agent metadata-agent linuxbridge-agent; do
systemctl restart neutron-$service
done

[3] Change settings on Compute Node.
root@node01:~#
echo 'net.bridge.bridge-nf-call-iptables=1' >> /etc/sysctl.conf

root@node01:~#
echo 'net.bridge.bridge-nf-call-ip6tables=1' >> /etc/sysctl.conf

root@node01:~#
sysctl -p

root@node01:~#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# line 115: add a value to tenant_network_types

tenant_network_types =
vxlan
# line 166: add

[ml2_type_flat]
flat_networks = physnet1
# line 220: add

[ml2_type_vxlan]
vni_ranges = 1:1000
root@node01:~#
vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
# line 114: add

[agent]
prevent_arp_spoofing = True
# line 181: add

[vxlan]
enable_vxlan = True
l2_population = True
root@node01:~#
systemctl restart neutron-linuxbridge-agent

[4] Create a Virtual router. It's OK to work on any node. (This example is on Control Node)
root@dlp ~(keystone)#
openstack router create router01

Created a new router:
+-------------------------+--------------------------------------+
| Field                   | Value                                |
+-------------------------+--------------------------------------+
| admin_state_up          | UP                                   |
| availability_zone_hints |                                      |
| availability_zones      |                                      |
| created_at              | 2017-03-16T05:47:22Z                 |
| description             |                                      |
| distributed             | False                                |
| external_gateway_info   | None                                 |
| flavor_id               | None                                 |
| ha                      | False                                |
| id                      | 3dd71e78-6f72-4ea9-95cd-94f2fdfd58b7 |
| name                    | router01                             |
| project_id              | ef6b5d01da394383a1afba725735a727     |
| revision_number         | None                                 |
| routes                  |                                      |
| status                  | ACTIVE                               |
| updated_at              | 2017-03-16T05:47:22Z                 |
+-------------------------+--------------------------------------+
[5] Create internal network and associate with the router above.
# create internal network

root@dlp ~(keystone)#
openstack network create int_net --provider-network-type vxlan

+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | UP                                   |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2017-03-16T05:47:59Z                 |
| description               |                                      |
| dns_domain                | None                                 |
| id                        | 428b6cd1-2df4-446c-a1c2-0cab74a730ac |
| ipv4_address_scope        | None                                 |
| ipv6_address_scope        | None                                 |
| is_default                | None                                 |
| mtu                       | 1450                                 |
| name                      | int_net                              |
| port_security_enabled     | True                                 |
| project_id                | ef6b5d01da394383a1afba725735a727     |
| provider:network_type     | vxlan                                |
| provider:physical_network | None                                 |
| provider:segmentation_id  | 80                                   |
| qos_policy_id             | None                                 |
| revision_number           | 3                                    |
| router:external           | Internal                             |
| segments                  | None                                 |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| updated_at                | 2017-03-16T05:47:59Z                 |
+---------------------------+--------------------------------------+

# create subnet in the internal network

root@dlp ~(keystone)#
openstack subnet create subnet1 --network int_net \
--subnet-range 192.168.100.0/24 --gateway 192.168.100.1 \
--dns-nameserver 10.0.0.10

+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| allocation_pools  | 192.168.100.2-192.168.100.254        |
| cidr              | 192.168.100.0/24                     |
| created_at        | 2017-03-16T05:48:40Z                 |
| description       |                                      |
| dns_nameservers   | 10.0.0.10                            |
| enable_dhcp       | True                                 |
| gateway_ip        | 192.168.100.1                        |
| host_routes       |                                      |
| id                | e4ad1184-3d88-4ac4-b89d-cf509cb0c52e |
| ip_version        | 4                                    |
| ipv6_address_mode | None                                 |
| ipv6_ra_mode      | None                                 |
| name              | subnet1                              |
| network_id        | 428b6cd1-2df4-446c-a1c2-0cab74a730ac |
| project_id        | ef6b5d01da394383a1afba725735a727     |
| revision_number   | 2                                    |
| segment_id        | None                                 |
| service_types     |                                      |
| subnetpool_id     | None                                 |
| updated_at        | 2017-03-16T05:48:40Z                 |
+-------------------+--------------------------------------+

# set internal network to the router above

root@dlp ~(keystone)#
openstack router add subnet router01 subnet1

[6] Create external network and associate with the router above.
# create external network

root@dlp ~(keystone)#
openstack network create \
--provider-physical-network physnet1 \
--provider-network-type flat --external ext_net

+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | UP                                   |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2017-03-16T05:49:43Z                 |
| description               |                                      |
| dns_domain                | None                                 |
| id                        | febd4268-45ce-4690-8252-d4ebdab9bccc |
| ipv4_address_scope        | None                                 |
| ipv6_address_scope        | None                                 |
| is_default                | False                                |
| mtu                       | 1500                                 |
| name                      | ext_net                              |
| port_security_enabled     | True                                 |
| project_id                | ef6b5d01da394383a1afba725735a727     |
| provider:network_type     | flat                                 |
| provider:physical_network | physnet1                             |
| provider:segmentation_id  | None                                 |
| qos_policy_id             | None                                 |
| revision_number           | 4                                    |
| router:external           | External                             |
| segments                  | None                                 |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| updated_at                | 2017-03-16T05:49:44Z                 |
+---------------------------+--------------------------------------+

# create subnet in external network

root@dlp ~(keystone)#
openstack subnet create subnet2 \
--network ext_net --subnet-range 10.0.0.0/24 \
--allocation-pool start=10.0.0.200,end=10.0.0.254 \
--gateway 10.0.0.1 --dns-nameserver 10.0.0.10 --no-dhcp

+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| allocation_pools  | 10.0.0.200-10.0.0.254                |
| cidr              | 10.0.0.0/24                          |
| created_at        | 2017-03-16T05:50:21Z                 |
| description       |                                      |
| dns_nameservers   | 10.0.0.10                            |
| enable_dhcp       | False                                |
| gateway_ip        | 10.0.0.1                             |
| host_routes       |                                      |
| id                | 4059076f-63b8-4167-bb04-79258025fb81 |
| ip_version        | 4                                    |
| ipv6_address_mode | None                                 |
| ipv6_ra_mode      | None                                 |
| name              | subnet2                              |
| network_id        | febd4268-45ce-4690-8252-d4ebdab9bccc |
| project_id        | ef6b5d01da394383a1afba725735a727     |
| revision_number   | 2                                    |
| segment_id        | None                                 |
| service_types     |                                      |
| subnetpool_id     | None                                 |
| updated_at        | 2017-03-16T05:50:21Z                 |
+-------------------+--------------------------------------+

# set gateway to the router above

root@dlp ~(keystone)#
openstack router set router01 --external-gateway ext_net

[7] Create and start Virtual machine Instance.
root@dlp ~(keystone)#
Int_Net_ID=`openstack network list | grep int_net | awk '{ print $2 }'`

root@dlp ~(keystone)#
openstack image list

+--------------------------------------+------------+--------+
| ID                                   | Name       | Status |
+--------------------------------------+------------+--------+
| 94b334bf-178f-46b2-ac6f-4e49de6442a1 | Ubuntu1604 | active |
+--------------------------------------+------------+--------+

root@dlp ~(keystone)#
openstack server create --flavor m1.small --image Ubuntu1604 --security-group default --nic net-id=$Int_Net_ID Ubuntu_1604

root@dlp ~(keystone)#
openstack server list

+--------------------+-------------+--------+---------------------+------------+
| ID                 | Name        | Status | Networks            | Image Name |
+--------------------+-------------+--------+---------------------+------------+
| 17ae3ad9-0a0d-     | Ubuntu_1604 | ACTIVE | int_net=192.168.100 | Ubuntu1604 |
| 485d-              |             |        | .8                  |            |
| b1c1-461821b0b1d2  |             |        |                     |            |
+--------------------+-------------+--------+---------------------+------------+
[8] Assign floating IP address to the Instance above.
root@dlp ~(keystone)#
openstack floating ip create ext_net

Created a new floatingip:
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2017-03-16T05:53:04Z                 |
| description         |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | 10.0.0.205                           |
| floating_network_id | febd4268-45ce-4690-8252-d4ebdab9bccc |
| id                  | 14425492-59c8-41eb-b2ce-5a396789b4ea |
| name                | None                                 |
| port_id             | None                                 |
| project_id          | ef6b5d01da394383a1afba725735a727     |
| revision_number     | 1                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| updated_at          | 2017-03-16T05:53:04Z                 |
+---------------------+--------------------------------------+

root@dlp ~(keystone)#
openstack server add floating ip Ubuntu_1604 10.0.0.205

# show settings

root@dlp ~(keystone)#
openstack floating ip show 10.0.0.205

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2017-03-16T05:53:04Z                 |
| description         |                                      |
| fixed_ip_address    | 192.168.100.8                        |
| floating_ip_address | 10.0.0.205                           |
| floating_network_id | febd4268-45ce-4690-8252-d4ebdab9bccc |
| id                  | 14425492-59c8-41eb-b2ce-5a396789b4ea |
| name                | None                                 |
| port_id             | 223f7838-ae6b-404a-b524-63715a8055d6 |
| project_id          | ef6b5d01da394383a1afba725735a727     |
| revision_number     | 2                                    |
| router_id           | 3dd71e78-6f72-4ea9-95cd-94f2fdfd58b7 |
| status              | ACTIVE                               |
| updated_at          | 2017-03-16T05:53:45Z                 |
+---------------------+--------------------------------------+
[9] Configure security settings like follows to access with SSH and ICMP.
# permit ICMP

root@dlp ~(keystone)#
openstack security group rule create --protocol icmp --ingress default

+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| created_at        | 2017-03-10T06:45:14Z                 |
| description       |                                      |
| direction         | ingress                              |
| ether_type        | IPv4                                 |
| id                | faf40532-ceea-41ad-a5fb-11b857c022ce |
| name              | None                                 |
| port_range_max    | None                                 |
| port_range_min    | None                                 |
| project_id        | 763d3fd7411e4b42982d4d7022f1e335     |
| protocol          | icmp                                 |
| remote_group_id   | None                                 |
| remote_ip_prefix  | 0.0.0.0/0                            |
| revision_number   | 1                                    |
| security_group_id | cb6894d3-846b-4135-8cc6-25842b67c6a6 |
| updated_at        | 2017-03-10T06:45:14Z                 |
+-------------------+--------------------------------------+

# permit SSH

root@dlp ~(keystone)#
openstack security group rule create --protocol tcp --dst-port 22:22 default

+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| created_at        | 2017-03-10T06:45:31Z                 |
| description       |                                      |
| direction         | ingress                              |
| ether_type        | IPv4                                 |
| id                | 15421d61-0343-40f9-8086-2e53e526248d |
| name              | None                                 |
| port_range_max    | 22                                   |
| port_range_min    | 22                                   |
| project_id        | 763d3fd7411e4b42982d4d7022f1e335     |
| protocol          | tcp                                  |
| remote_group_id   | None                                 |
| remote_ip_prefix  | 0.0.0.0/0                            |
| revision_number   | 1                                    |
| security_group_id | cb6894d3-846b-4135-8cc6-25842b67c6a6 |
| updated_at        | 2017-03-10T06:45:31Z                 |
+-------------------+--------------------------------------+

root@dlp ~(keystone)#
openstack security group rule list

+------------+-------------+-----------+------------+-----------------------+----------------+
| ID         | IP Protocol | IP Range  | Port Range | Remote Security Group | Security Group |
+------------+-------------+-----------+------------+-----------------------+----------------+
| 15421d61-0 | tcp         | 0.0.0.0/0 | 22:22      | None                  | cb6894d3-846b- |
| 343-40f9-8 |             |           |            |                       | 4135-8cc6-2584 |
| 086-2e53e5 |             |           |            |                       | 2b67c6a6       |
| 26248d     |             |           |            |                       |                |
| 9928f5fc-8 | None        | None      |            | None                  | cb6894d3-846b- |
| c94-4458-8 |             |           |            |                       | 4135-8cc6-2584 |
| 3a6-9a8678 |             |           |            |                       | 2b67c6a6       |
| 8fb5ee     |             |           |            |                       |                |
| bce04897-a | None        | None      |            | cb6894d3-846b-4135-8c | cb6894d3-846b- |
| 9b2-4b80-8 |             |           |            | c6-25842b67c6a6       | 4135-8cc6-2584 |
| 709-6fbcbf |             |           |            |                       | 2b67c6a6       |
| 459ef7     |             |           |            |                       |                |
| faf40532   | icmp        | 0.0.0.0/0 |            | None                  | cb6894d3-846b- |
| -ceea-     |             |           |            |                       | 4135-8cc6-2584 |
| 41ad-a5fb- |             |           |            |                       | 2b67c6a6       |
| 11b857c022 |             |           |            |                       |                |
| ce         |             |           |            |                       |                |
| fba7a2cb-  | None        | None      |            | cb6894d3-846b-4135-8c | cb6894d3-846b- |
| 03fa-4c11  |             |           |            | c6-25842b67c6a6       | 4135-8cc6-2584 |
| -aadd-ebab |             |           |            |                       | 2b67c6a6       |
| 85838be9   |             |           |            |                       |                |
| fe1ae047   | None        | None      |            | None                  | cb6894d3-846b- |
| -9bdd-43b1 |             |           |            |                       | 4135-8cc6-2584 |
| -b6bd-62fa |             |           |            |                       | 2b67c6a6       |
| 17442d87   |             |           |            |                       |                |
+------------+-------------+-----------+------------+-----------------------+----------------+
[10] It's possible to login to the Instance to connect to the IP address with SSH like follows.
root@dlp ~(keystone)#
ssh ubuntu@10.0.0.205

The authenticity of host '10.0.0.205 (10.0.0.205)' can't be established.
ECDSA key fingerprint is SHA256:hb0tkx8NUhkoyhBHfEEY2Hs0L+wXHRwfE953hgK0CpQ.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.205' (ECDSA) to the list of known hosts.
ubuntu@10.0.0.205's password:
Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-66-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
Last login: Wed Mar 15 09:46:46 2017
ubuntu@ubuntu:~$    
# just logined
 
Tweet